﻿using Cocon90.Lib.Dal;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        IDataHelper dh = Cocon90.Lib.Dal.DataHelperFactory.CreateInstence();
        private void button1_Click(object sender, EventArgs e)
        {
            Cocon90.Lib.Dal.Tools.ModelHelper<Model.AdminTab> amh = new Cocon90.Lib.Dal.Tools.ModelHelper<Model.AdminTab>();
            var res = amh.EditByPrimeryKey(new Model.AdminTab
            {
                AName = "繁星",
                AUnitId = "370129000000",
                AHasDelete = false,
                ALevel = "市局用户",
                APassword = "123456",
                APermission = "登记,审批"
            }, "370129", false);
            MessageBox.Show(res + "");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Cocon90.Lib.Dal.Tools.ModelHelper<Model.AdminTab> amh = new Cocon90.Lib.Dal.Tools.ModelHelper<Model.AdminTab>();
            var res = amh.EditByCustomWhere(new Model.AdminTab
            {
                AName = "繁星1号",
                AUnitId = "370129000000",
                AHasDelete = false,
                ALevel = "市局用户",
                APassword = null,
                APermission = "登记,审批"
            }, "AId=@AId", true, dh.createParameter("@AId", "370129"));
            MessageBox.Show(res + "");

        }
    }
}
